import java.util.Arrays;

public class MaoPaoDemo01 {


    public static void main(String[] args) {

        /*
            100, 102, 50, 20, 80, 70

            1
             100, 102, 50, 20, 80, 70
             100, 50, 102, 20, 80, 70
             100, 50, 20, 102, 80, 70
             100, 50, 20, 80, 102, 70
             100, 50, 20, 80, 70, 102

             100, 50, 20, 80, 70

          2  50,100 , 20, 80, 70
             50,20 , 100, 80, 70
             50,20 , 80, 100, 70
             50,20 , 80, 70, 100

            50,20 , 80, 70

         3  20,50 , 80, 70
            20,50 , 80, 70
            20,50 , 70, 80

            20,50 ,70
         4   20,50 ,70
            20,50 ,70


            20,50

         5  20,50
         */

        int[] nums = {100, 102, 50, 20, 80, 70};
        for (int i = 1; i < nums.length; i++) {// 比5轮
            for (int j = 0; j < nums.length - i; j++) {// 比几次
                if (nums[j] > nums[j + 1]) {
                    int temp = nums[j + 1];
                    nums[j + 1] = nums[j];
                    nums[j] = temp;
                }
            }
            System.out.println(Arrays.toString(nums));

        }
//        System.out.println(Arrays.toString(nums));
        /*
            1   5
            2   4
            3   3
            2   2
            1   1
         */

    }
}
